# -*- coding:utf-8 -*-
import django
from django import http
from django.template import loader, Context

from seblog.settings import STATIC_PATH

def index(request):
    r = http.HttpResponse('<h1>u are welcome,垃圾邓</h1><ul>')
    r.write('<li><a href="###">sign in</a></li>')
    r.write('<li><a href="blog/">see my blog</a></li>')
    r.write('<li><a href="demo/">see my demo</a></li>')
    r.write('</ul>')
    return r

def test_url(request):
    #r = http.HttpResponse('<h1>test</h1><ul>')
    #r.write('<li><a href="###">test</a></li>')
    #r.write('</ul>')
    #return r
	
    from seblog.web.render import render_to_response
    template = 'demoapp/google9521cdc3b9497ea4.html'
    return render_to_response(template, {}, request)

def sitemap_url(request):
	#11
	#import os
	#xml_path = os.path.join(STATIC_PATH,'xml','sitemap.xml')
	#f = open(xml_path, 'r')
	#data = f.read()
	#return http.HttpResponse(data, mimetype='text/xml')
	
	#22
	#from seblog.web.render import render_to_response
	#xml = render_to_response('demoapp/sitemap.xml',{'code': 501, 'description': "query error"})
        #return http.HttpResponse( xml, mimetype='text/xml')
	
	#33
        t = loader.get_template('demoapp/sitemap.xml')
        c = Context('DATA')                 
        return http.HttpResponse(t.render(c), mimetype='text/xml')
              
